package com.qidianit.mes.device.controller;


import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.device.service.ToolsLedgerService;
import com.qidianit.mes.pojo.MesToolsLedger;
import com.qidianit.mes.pojo.MesToolsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/toolsLedger")
@CrossOrigin
public class ToolsLedgerController {

    @Autowired
    ToolsLedgerService toolsLedgerService;
    @GetMapping("/list")
    public MESResult list(String toolCode, String toolName, String toolTypeId,String brand,String model,String status,
                          @RequestParam(defaultValue = "1")int page,
                          @RequestParam(defaultValue = "10")int limit) {
        MESResult mesResult = toolsLedgerService.list(toolCode,toolName,toolTypeId,brand,model,status,page,limit);
        return mesResult;
    }

    @PostMapping("/add")
    public MESResult add(@RequestBody MesToolsLedger mesToolsLedger){
        return toolsLedgerService.add(mesToolsLedger);
    }
    @PostMapping("/edit")
    public MESResult edit(@RequestBody MesToolsLedger mesToolsLedger){
        return toolsLedgerService.edit(mesToolsLedger);
    }
    @DeleteMapping("/delete")
    public MESResult delete(String toolCode){
        return toolsLedgerService.delete(toolCode);
    }
}
